Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

246
Vistas
ReactJs - Reset field after "x" time after submit

The task is to empty the fields after clicking the "submit" button... I used this function:

setInterval(
        function submitForm() {
            document.getElementById("algo").reset();
        }, 3000);

But the problem is that it takes one or two seconds to send the mail and the function is executed instantly, the result is that the fields are emptied and then the mail is sent (arriving empty) ... in that order (function --> submit) and the real success must be : submit --> function

In addition, the function does not work since the interval is short if the message is long and it is long if I put "submit" and the text continues without disappearing

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda